package jsj.mynet;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.Socket;

public class MyTcpClient implements Runnable {
	private Socket s;
	
	public MyTcpClient(Socket s) {
		super();
		this.s = s;
	}

	@Override
	public void run() {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try {
			BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(s.getOutputStream()));
			String line = null;
			while((line = br.readLine())!= null){
				if(line.equals("exit")){
					break;
				}
				bw.write(line + "\n\r");
				bw.flush();
			}
			s.close();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		

	}

}
